<%--
  Created by IntelliJ IDEA.
  User: dqf
  Date: 2015/3/4
  Time: 16:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<section id="widget-grid" class="">

    <!-- row -->
    <div class="row">
        <!-- NEW WIDGET START -->
        <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
                <h1 class="page-title txt-color-blueDark" style="margin-top:6px;margin-bottom:10px">
                    <i class="fa fa-table fa-fw "></i>
                    项目预警
                </h1>
            </div>
            <!-- Widget ID (each widget will need unique ID)-->
            <div class="jarviswidget " id="wid-id-0" data-widget-editbutton="false"
                 data-widget-colorbutton="false"
                 data-widget-togglebutton="false"
                 data-widget-deletebutton="false"
                 data-widget-fullscreenbutton="true"
                 data-widget-custombutton="false"
                 data-widget-sortable="false">
                <div>

                    <!-- widget edit box -->
                    <div class="jarviswidget-editbox">
                        <!-- This area used as dropdown edit box -->

                    </div>
                    <!-- end widget edit box -->

                    <!-- widget content -->
                    <div class="widget-body no-padding">

                        <div class="col-sm-12 col-md-12 col-lg-12">
                            <div >
                                <div class="row" id="ajax_proback_list_row">
                                    <table id="ajax_proback_table" class="table table-striped table-bordered table-hover">
                                    </table>
                                    <div id="ajax_proback_list_page">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- end widget content -->

                </div>
                <!-- end widget div -->

            </div>
            <!-- end widget -->

        </article>
        <!-- WIDGET END -->

    </div>

    <!-- end row -->

    <!-- end row -->

</section>
<script type="text/javascript">
    pageSetUp();
    $(function(){
        load_proback_jqGrid();
    });
    function load_proback_jqGrid(){
        jQuery("#ajax_proback_table").jqGrid({
            url:'ajax-pro-back!warnlist.action',
            datatype: "json",
            colNames:['项目名称',"反馈日期",'反馈类别',"反馈内容","反馈人","是否正常","通知人员","操作","id"],
            colModel:[
                {name:'proname',index:'name', width:120,sortable:true,search:true,
                    searchoptions:{sopt: ["cn"],clearSearch:true}},
                {name:'backDate',index:'backDate', width:80,search:false,sortable:true,
                    searchoptions:{sopt: ["cn"],clearSearch:true}},
                {name:'category',index:'category', width:80,search:true,sortable:true,
                    searchoptions:{sopt: ["cn"],clearSearch:true}},
                {name:'content',index:'content', width:180,search:false},
                {name:'creater',index:'creater', width:80,search:true,
                    searchoptions:{sopt: ["cn"],clearSearch:true}},
                {name:'regular',index:'regular', width:80,search:false,
                    searchoptions:{sopt: ["cn"],clearSearch:true}},
                {name:'notice',index:'notice', width:180,search:false,resizable:true,formatter:sizeFmatter},
                {name:'act',index:'act', width:100,sortable:false,fixed:true,search:false},
                {name:'id',index:'id',hidden:true,search:false},
            ],
            rowNum : 10,
            rowList:[10,20,30],
            pager : '#ajax_proback_list_page',
            sortname : 'backDate',
            sortorder : "desc",
            gridComplete:function(){

                var ids=$("#ajax_proback_table").jqGrid('getDataIDs');
                for(var i=0;i<ids.length;i++){
                    var cl=ids[i];
                    var rowData = $("#ajax_proback_table").jqGrid("getRowData",cl);
                    var de="<button class='btn btn-default' data-original-title='查看' onclick=\"fn_proback_read('"+cl+"');\"><i class='fa fa-eye'></i>查看</button>"+" ";
                    jQuery("#ajax_proback_table").jqGrid('setRowData',ids[i],{act:de});
                }

                $(".ui-jqgrid-bdiv").css("overflow-x","hidden");

                jqGridStyle();

            },
            jsonReader: {
                root: "dataRows",
                page: "page",
                total: "total",
                records: "records",
                repeatitems : false
            },
            caption : "<i class='fa fa-arrow-circle-right'></i> 预警列表",
            multiselect : false,
            rownumbers:true,
            gridview:true,
            shrinkToFit:true,
            viewrecords: true,
            autowidth: true,
            height:'auto',
            forceFit:true,
            loadComplete: function() {
            }
        });
        $(window).on('resize.jqGrid', function() {
            jQuery("#ajax_proback_table").jqGrid('setGridWidth', $("#ajax_proback_list_row").width());
        });
        jQuery("#ajax_proback_table").jqGrid('filterToolbar',{searchOperators:false,stringResult:true});
        jQuery("#ajax_proback_table").jqGrid('navGrid', "#ajax_proback_list_page", {
            edit : false,
            add : false,
            del : false,
            search:false
        });
    }

    function fn_proback_read(id){
        loadURL("ajax-pro-back!read.action?keyId="+id+"&viewType=3",$('#content'));
    }

    function fn_proback_destroy(id){
        var vActionUrl = "<%=path%>/com/ajax-proback!delete.action";
        data={keyId:id};
        ajax_action(vActionUrl,data,{},function(pdata){
            _show(pdata);
        });
        jQuery("#ajax_proback_table").trigger("reloadGrid");
    }


    $("#ajax_download_proInfo_datas").click(function(){
        loadURL("ajax!downloadFile.action",$("#content"));
    });
</script>